/**
 * 
 */
package cbm.commons;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.naming.InitialContext;
import javax.sql.DataSource;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;

/**
 * @author indra
 *
 */
public class Conexion {
	
	static Logger logger = Logger.getLogger(Conexion.class.getName());
	
	public static Connection getConnection(){
		InitialContext context = null;
		DataSource dataSource = null;
		Connection con = null;

		/*
		try {
			context = new InitialContext();
		    dataSource = (DataSource) context.lookup("jdbc/CONNEG");
		    con = dataSource.getConnection();
		    //con.setAutoCommit(false);
		} catch(Exception e){
			logger.log("BaseFacade.getConnection failed", Level.FATAL,null, e);
		}
		*/
		try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
			con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","APP_CONNEG","sistemas");
		} catch (Exception e) {
			logger.log("Conexion.getConnection failed", Level.FATAL,null, e);
		}
	    
	    return con;
	}

}
